/**
 * LEKU APPLIANCE CHAINS.
 * Copyright (c) 2016-2016 All Rights Reserved.
 */
package com.leku.video.dao.impl.video;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.leku.commons.datasource.DataSourceClient;
import com.leku.video.dao.video.VideoDao;
import com.leku.video.dto.result.video.EpisodeResDto;
import com.leku.video.dto.result.video.VideoDto;
import com.leku.video.dto.result.video.VideoUrlDto;

/**
 * 功能描述:
 *
 * @author Ranphy
 * @created 2018年10月24日
 * @version 1.0.0
 */
@Repository
public class VideoDaoImpl implements VideoDao {

	@Autowired
	private DataSourceClient dataSourceClient;

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.leku.video.dao.video.VideoDao#findVideoDetail(java.lang.String)
	 */
	@Override
	public VideoDto findYSVideoDetail(String id) {
		Map<String, Object> param = new HashMap<String, Object>();

		param.put("id", id);

		return dataSourceClient.selectOne("videoDao.findYSVideoDetail", param);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.leku.video.dao.video.VideoDao#findEpisodes(java.lang.String)
	 */
	@Override
	public List<EpisodeResDto> findYSEpisodes(String id,String type) {

		Map<String, Object> param = new HashMap<String, Object>();

		param.put("id", id);
		param.put("type", type);

		return dataSourceClient.selectList("videoDao.findYSEpisodes", param);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.leku.video.dao.video.VideoDao#findVideoDetail(java.lang.String)
	 */
	@Override
	public VideoDto findVideoDetail(String id) {
		Map<String, Object> param = new HashMap<String, Object>();

		param.put("id", id);

		return dataSourceClient.selectOne("videoDao.findVideoDetail", param);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.leku.video.dao.video.VideoDao#findEpisodes(java.lang.String)
	 */
	@Override
	public List<EpisodeResDto> findEpisodes(String id) {

		Map<String, Object> param = new HashMap<String, Object>();

		param.put("id", id);

		return dataSourceClient.selectList("videoDao.findEpisodes", param);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.leku.video.dao.video.VideoDao#findYSVideoAddrs(java.lang.String)
	 */
	@Override
	public List<VideoUrlDto> findYSVideoAddrs(String lekuid, String seg) {

		Map<String, Object> param = new HashMap<String, Object>();

		param.put("seg", seg);
		param.put("lekuid", lekuid);

		return dataSourceClient.selectList("videoDao.findYSVideoAddrs", param);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.leku.video.dao.video.VideoDao#findVideoAddrs(java.lang.String)
	 */
	@Override
	public List<VideoUrlDto> findVideoAddrs(String id) {

		Map<String, Object> param = new HashMap<String, Object>();

		param.put("id", id);

		return dataSourceClient.selectList("videoDao.findVideoAddrs", param);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.leku.video.dao.video.VideoDao#findVideoType(java.lang.String)
	 */
	@Override
	public int findVideoType(String id) {
		
		return dataSourceClient.selectOne("videoDao.findVideoType", id);
	}

}
